**GSE IAT scoring syntax-revised for final cases 9-29-15 SD

**name of data file being scored will need to be replaced in 11 places; here it's '121f'.

**Import each data file in to SPSS and convert some variable names as needed 

GET DATA
  /TYPE=TXT
  /FILE="C:\Users\Sarah\Desktop\GSE\New GSE\Couples survey\Data\Round 3\IAT\females\text files\121f.txt"
  /DELCASE=LINE
  /DELIMITERS="\t"
  /ARRANGEMENT=DELIMITED
  /FIRSTCASE=7
  /IMPORTCASE=ALL
  /VARIABLES=
  @121f A10
  ID A2
  Block A26
  V4 A26
  V5 A32
  V6 A4
  V7 F1.0
  V8 A7
  V9 A14
  response A1
  LATENCY F7.0
  V12 F1.0
  V13 F1.0
  V14 F1.0
  V15 F1.0
  V16 F1.0.
CACHE.
EXECUTE.
DATASET NAME DataSet3 WINDOW=FRONT.


SAVE OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\females\121f.sav'
  /COMPRESSED.


*DELETION OF LATENCIES above 10000 ms or below 400 ms for LATENCY .


*Mark trials with latency < 400 ms.
COMPUTE FLAG_400 = 0 .
IF (LATENCY < 400) FLAG_400 = 1 .
EXECUTE. 
*Mark trials with latency > 10000 ms .
COMPUTE FLAG_10K = 0 .
IF (LATENCY GT 10000) FLAG_10K = 1 .
EXECUTE.

COMPUTE VALIDLAT=FLAG_400+FLAG_10K.
EXECUTE.


SELECT IF (VALIDLAT=0).
EXECUTE.



RECODE block ('selfcareerprac'='3') ('selfcareerBlock'='4') ('careerselfprac'='6') ('careerselfBlock'='7').
EXECUTE.

RECODE block ('GCUpracblock'='10') ('GCUblock'='11') ('GCEpracblock'='13') ('GCEblock'='14').
EXECUTE.


**convert block variable to numeric format (renames to blockb)

RECODE block (CONVERT) into blockb.
EXECUTE.

RENAME VARIABLES block=blockc.
execute.

RENAME VARIABLES blockb=BLOCK.
execute.


**create variable Block2 to facilitate computation of inclusive st dev.

RECODE Block (3=1) (6=1) (4=2) (7=2) (10=3) (13=3) (11=4) (14=4) INTO Block2.
VARIABLE LABELS  Block2 'pairs of blocks for comp. inclusive st. dev.'.
EXECUTE.

**For the "self/other" IAT

**Compute 'inclusive' standard deviation for blocks 3 and 6
**first, select cases to include only blocks 3 and 6

COMPUTE filter_$=(block2=1).
VARIABLE LABELS filter_$ 'block2=1 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

**then compute inclusive st. dev. for blocks 3 and 6 and save stand. value in a separate file

AGGREGATE
  /OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\scoring\IATstdev1.sav'
  /PRESORTED
  /BREAK=block2
  /latency_sd_3and6 'inclusive st dev for trials in block 3 and 6'=SD(latency).

**Compute 'inclusive' standard deviation for blocks 4 and 7
**first, select cases to include only blocks 4 and 7

COMPUTE filter_$=(block2=2).
VARIABLE LABELS filter_$ 'block2=2 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

**then compute inclusive st. dev. for blocks 4 and 7 and save stand. value in a separate file

AGGREGATE
  /OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\scoring\IATstdev2.sav'
  /PRESORTED
  /BREAK=block2
  /latency_sd_4and7 'inclusive st dev for trials in block 4 and 7'=SD(latency).

**Compute the mean latency for each of blocks 3, 4, 6 and 7 and save values in separate files

FILTER OFF.
USE ALL.
EXECUTE.


**BLOCK 3

USE ALL.
COMPUTE filter_$=(block=3).
VARIABLE LABELS filter_$ 'block=3 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

AGGREGATE
  /OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\scoring\IATmean3.sav'
  /PRESORTED
  /BREAK=block
  /latency_mean_block_3 'mean of RT for trials in block 3'=MEAN(latency).

**BLOCK 4

USE ALL.
COMPUTE filter_$=(block=4).
VARIABLE LABELS filter_$ 'block=4 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

AGGREGATE
  /OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\scoring\IATmean4.sav'
  /PRESORTED
  /BREAK=block
  /latency_mean_block_4 'mean of RT for trials in block 4'=MEAN(latency).


**BLOCK 6

USE ALL.
COMPUTE filter_$=(block=6).
VARIABLE LABELS filter_$ 'block=6 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

AGGREGATE
  /OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\scoring\IATmean6.sav'
  /PRESORTED
  /BREAK=block
  /latency_mean_block_6 'mean of RT for trials in block 6'=MEAN(latency).

**BLOCK 7

USE ALL.
COMPUTE filter_$=(block=7).
VARIABLE LABELS filter_$ 'block=7 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

AGGREGATE
  /OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\scoring\IATmean7.sav'
  /PRESORTED
  /BREAK=block
  /latency_mean_block_7 'mean of RT for trials in block 7'=MEAN(latency).


**merge the 6 files from the previous steps in to one file

GET 
  FILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\scoring\IATstdev1.sav'. 
DATASET NAME DataSet9 WINDOW=FRONT.

DATASET ACTIVATE DataSet9.
MATCH FILES /FILE=*
  /FILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\scoring\IATstdev2.sav'.
EXECUTE.

MATCH FILES /FILE=*
  /FILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\scoring\IATmean3.sav'.
EXECUTE.

MATCH FILES /FILE=*
  /FILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\scoring\IATmean4.sav'.
EXECUTE.

MATCH FILES /FILE=*
  /FILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\scoring\IATmean6.sav'.
EXECUTE.

MATCH FILES /FILE=*
  /FILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\scoring\IATmean7.sav'.
EXECUTE.

**Compute the mean difference of blocks 6 and 3 and divide by the inclusive st dev of those blocks

COMPUTE ratio1=(latency_mean_block_6-latency_mean_block_3) / latency_sd_3and6.
EXECUTE.

**Compute the mean difference of blocks 7 and 4 and divide by the inclusive st dev of those blocks

COMPUTE ratio2=(latency_mean_block_7-latency_mean_block_4) / latency_sd_4and7.
EXECUTE.

**Compute D as "the equal weight average of the two resulting ratios" (per Greenwald, Nosek, and Banaji, 2003)

COMPUTE Dmeasure=MEAN(ratio1,ratio2).
EXECUTE.


**save the new file as "calcDself121f"

SAVE OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\females\calcDself121f.sav' 
  /COMPRESSED.


**GSE IAT scoring syntax-updated 9-29-15 SD

**Import each data file in to SPSS and convert some variable names as needed 

GET DATA
  /TYPE=TXT
  /FILE="C:\Users\Sarah\Desktop\GSE\New GSE\Couples survey\Data\Round 3\IAT\females\text files\121f.txt"
  /DELCASE=LINE
  /DELIMITERS="\t"
  /ARRANGEMENT=DELIMITED
  /FIRSTCASE=7
  /IMPORTCASE=ALL
  /VARIABLES=
  @121f A10
  ID A2
  Block A26
  V4 A26
  V5 A32
  V6 A4
  V7 F1.0
  V8 A7
  V9 A14
  response A1
  LATENCY F7.0
  V12 F1.0
  V13 F1.0
  V14 F1.0
  V15 F1.0
  V16 F1.0.
CACHE.
EXECUTE.
DATASET NAME DataSet3 WINDOW=FRONT.


SAVE OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\females\121f.sav'
  /COMPRESSED.


*DELETION OF LATENCIES above 10000 ms or below 400 ms for LATENCY .


*Mark trials with latency < 400 ms.
COMPUTE FLAG_400 = 0 .
IF (LATENCY < 400) FLAG_400 = 1 .
EXECUTE. 
*Mark trials with latency > 10000 ms .
COMPUTE FLAG_10K = 0 .
IF (LATENCY GT 10000) FLAG_10K = 1 .
EXECUTE.

COMPUTE VALIDLAT=FLAG_400+FLAG_10K.
EXECUTE.


SELECT IF (VALIDLAT=0).
EXECUTE.



RECODE block ('selfcareerprac'='3') ('selfcareerBlock'='4') ('careerselfprac'='6') ('careerselfBlock'='7').
EXECUTE.

RECODE block ('GCUpracblock'='10') ('GCUblock'='11') ('GCEpracblock'='13') ('GCEblock'='14').
EXECUTE.


**convert block variable to numeric format (renames to blockb)

RECODE block (CONVERT) into blockb.
EXECUTE.

RENAME VARIABLES block=blockc.
execute.

RENAME VARIABLES blockb=BLOCK.
execute.


**create variable Block2 to facilitate computation of inclusive st dev.

RECODE Block (3=1) (6=1) (4=2) (7=2) (10=3) (13=3) (11=4) (14=4) INTO Block2.
VARIABLE LABELS  Block2 'pairs of blocks for comp. inclusive st. dev.'.
EXECUTE.



**For the "gender/career" IAT


**Compute 'inclusive' standard deviation for blocks 10 and 13
**first, select cases to include only blocks 10 and 13


COMPUTE filter_$=(block2=3).
VARIABLE LABELS filter_$ 'block2=3 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

**then compute inclusive st. dev. for blocks 10 and 13 and save stand. value in a separate file

AGGREGATE
  /OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\Scoring\IATstdev3.sav'
  /PRESORTED
  /BREAK=block2
 /latency_sd_10and13 'inclusive st dev for trials in block 10 and 13'=SD(latency).
EXECUTE.

 
**Compute 'inclusive' standard deviation for blocks 11 and 14
**first, select cases to include only blocks 11 and 14

COMPUTE filter_$=(block2=4).
VARIABLE LABELS filter_$ 'block2=4 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

**then compute inclusive st. dev. for blocks 11 and 14 and save stand. value in a separate file

AGGREGATE
  /OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\Scoring\IATstdev4.sav'
  /PRESORTED
  /BREAK=block2
  /latency_sd_11and14 'inclusive st dev for trials in block 11 and 14'=SD(latency).



**Compute the mean latency for each of blocks 10, 11, 13 and 14 and save values in separate files

FILTER OFF.
USE ALL.
EXECUTE.


**BLOCK 10

USE ALL.
COMPUTE filter_$=(block=10).
VARIABLE LABELS filter_$ 'block=10 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

AGGREGATE
  /OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\Scoring\IATmean10.sav'
  /PRESORTED
  /BREAK=block
  /latency_mean_block_10 'mean of RT for trials in block 10'=MEAN(latency).

**BLOCK 11

USE ALL.
COMPUTE filter_$=(block=11).
VARIABLE LABELS filter_$ 'block=11 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

AGGREGATE
  /OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\Scoring\IATmean11.sav'
  /PRESORTED
  /BREAK=block
  /latency_mean_block_11 'mean of RT for trials in block 11'=MEAN(latency).


**BLOCK 13

USE ALL.
COMPUTE filter_$=(block=13).
VARIABLE LABELS filter_$ 'block=13 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

AGGREGATE
  /OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\Scoring\IATmean13.sav'
  /PRESORTED
  /BREAK=block
  /latency_mean_block_13 'mean of RT for trials in block 13'=MEAN(latency).

**BLOCK 14

USE ALL.
COMPUTE filter_$=(block=14).
VARIABLE LABELS filter_$ 'block=14 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

AGGREGATE
  /OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\Scoring\IATmean14.sav'
  /PRESORTED
  /BREAK=block
  /latency_mean_block_14 'mean of RT for trials in block 14'=MEAN(latency).


**merge the 6 files from the previous steps in to one file

GET 
  FILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\Scoring\IATstdev3.sav'. 
DATASET NAME DataSet9 WINDOW=FRONT.

DATASET ACTIVATE DataSet9.
MATCH FILES /FILE=*
  /FILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\Scoring\IATstdev4.sav'.
EXECUTE.

MATCH FILES /FILE=*
  /FILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\Scoring\IATmean10.sav'.
EXECUTE.

MATCH FILES /FILE=*
  /FILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\Scoring\IATmean11.sav'.
EXECUTE.

MATCH FILES /FILE=*
  /FILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\Scoring\IATmean13.sav'.
EXECUTE.

MATCH FILES /FILE=*
  /FILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\Scoring\IATmean14.sav'.
EXECUTE.



**Compute the mean difference of blocks 13 and 10 and divide by the inclusive st dev of those blocks

COMPUTE ratio3=(latency_mean_block_13-latency_mean_block_10) / latency_sd_10and13.
EXECUTE.

**Compute the mean difference of blocks 14 and 11 and divide by the inclusive st dev of those blocks

COMPUTE ratio4=(latency_mean_block_14-latency_mean_block_11) / latency_sd_11and14.
EXECUTE.

**Compute D as "the equal weight average of the two resulting ratios" (per Greenwald, Nosek, and Banaji, 2003)

COMPUTE Dmeasureb=MEAN(ratio3,ratio4).
EXECUTE.


**save the new file as "calcDgencar121f"

SAVE OUTFILE='C:\Users\Sarah\Desktop\GSE\New GSE\Couples Survey\Data\Round 3\IAT\females\calcDgencar121f.sav' 
  /COMPRESSED.


**DONE!!!





